import QtQuick 2.0
import org.qtproject.qtquick 1.0


Rectangle {
    id: container
    width: parent.width
    color: "white"

    property string imageSource: "qrc:/image/resouces/images/drawable-hdpi/busy.png"
    property bool visibleForm: ApplicationInfo.isHasUpdateMoreArticle

    Line {}

    Column {
        id: id_waiting
        spacing: 20
        y: 20
        anchors.horizontalCenter: parent.horizontalCenter
        visible: visibleForm

        Image {
            id: image

            source: container.imageSource
            ParallelAnimation {
                running: true
                NumberAnimation { target: image; property: "opacity"; from: 0.0; to: 1.0; duration: 200 }
                NumberAnimation { target: image; property: "rotation"; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 }
            }
        }
        Text {
            width: parent.width
            text: qsTr("Đang tải dữ liệu...");
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter
        }

    }


    Column {
        id: id_noConnectData
        width: parent.width
        anchors.horizontalCenter: parent.horizontalCenter
        y: 20
        x: -20

        visible: !visibleForm

        spacing: 20

        Text {
            width: parent.width
            text: qsTr("Không tải được dữ liệu");
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter
        }

        Button {
            id: bttnImage
            width: parent.width - 50
            anchors.horizontalCenter: parent.horizontalCenter
            text: "Thử lại"

            onClicked: {
                console.log("ko tai dc du lieu...thu lai : cid = " + m_id);
                ApplicationInfo.onUpdateMoreArticleRequest(m_id);
            }
        }

    }

}
